package com.woniuxy.hw;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Component;

@Component
public class HoWorkConsumer {

    @Autowired
    JavaMailSender javaMailSender;

    @RabbitListener(queues = "hw_welcome_queue")
    public void receive(SimpleMailMessage message) {
        System.out.println("接收到消息:" + message.toString());
        javaMailSender.send(message);
    }
}
